﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LP580.CG;
using System.Text;
using System.Data;

public partial class User_UC1FavoritesQY : System.Web.UI.Page
{
    private clsUserAccount ua = clsUserAccount.getCookieUser(true);
    private string act = Utils.RQ_str("act");
    private int id = Utils.RQ_int("id");
    private int pageIndex = Utils.RQ_int("pi");
    private int pageSize = 12;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (act=="del")
            {
                clsFavoriteCompany.Delete(ua.UserID, id);
            }
            bindData();


        }
    }
    private void bindData()
    {
        PagedDataSource pds = new PagedDataSource();
        DBase db = new DBase();
        pds.DataSource = db.Execute("select CompanyID,CompanyName,SalesItem,ContactPerson,Mobile from tbl_UserCompanyInfo as a,tbl_FavoriteCompany as b where a.UserID=b.CompanyID and b.UserID=" + 5/*ua.UserID*/)[0].DefaultView;

        pds.PageSize = pageSize;
        pds.CurrentPageIndex = (pageIndex - 1 < 0) ? 0 : (pageIndex - 1);
        pds.AllowPaging = true;

        ltPage.Text = LvEasyPager.CreateUser("?", pageIndex, pageSize, pds.DataSourceCount);
        rpdata.DataSource = pds;
        rpdata.DataBind();
    }
}